package collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListDemoThree {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(i * 10);
        }
        System.out.println("list:" + list);
        List<Integer> s = list.subList(2, 5);
        System.out.println("list:" + s);
        System.out.println(s == list);//false
        for (int i = 0; i < list.size(); ++i) {
            list.set(i, list.get(i) * 10);
        }
        System.out.println("list:" + list);
        System.out.println("s:" + s);
        list.remove(3);
        System.out.println("list:" + list);
        //System.out.println("s:" + s);ConcurrentModificationException
    }
}